<template>
  <el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px">
    <el-table ref="tableSort" border="border" class="table" :data="dataRow">
      <!-- <el-table-column>类型</el-table-column>
      <el-table-column>数据值</el-table-column> -->
      <el-table-column
        v-for="(item, index) in columns"
        :key="index"
        align="center"
        :label="item.label"
        :sortable="item.sortable"
      >
        <template #default="{ row }">
          <span>{{ row[item.prop] }}</span>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
  // import { getList } from '@/api/shouye'

  export default {
    data() {
      return {
        columns: [
          {
            label: '品牌',
            width: 'auto',
            prop: 'brand',
            sortable: true,
          },
          {
            label: '型号',
            width: 'auto',
            prop: 'model',
            sortable: true,
          },
          {
            label: '系统平台',
            width: 'auto',
            prop: 'platform',
            sortable: true,
          },
          {
            label: '系统版本',
            width: 'auto',
            prop: 'system',
            sortable: true,
          },
          {
            label: '微信版本',
            width: 'auto',
            prop: 'version',
            sortable: true,
          },
          {
            label: '小程序版本',
            width: 'auto',
            prop: 'SDKVersion',
            sortable: true,
          },
          {
            label: '定位状态',
            width: 'auto',
            prop: 'locationAuthorized',
            sortable: true,
          },
          {
            label: '定位授权',
            width: 'auto',
            prop: 'locationEnabled',
            sortable: true,
          },
        ],
        title: '',
        border: true,
        dialogFormVisible: false,
        dataRow: [],
        queryForm: {},
        // listLoading: true,
      }
    },
    methods: {
      showEdit(row) {
        if (!row) {
          this.title = '添加'
        } else {
          this.title = '用户机型详情'
          this.form = Object.assign({}, row)
        }
        this.dialogFormVisible = true
        // 这边是数组和对象不能对接
        this.dataRow = row.user_phone
        console.log(this.dataRow, '是')
      },
    },
  }
</script>

<style scoped>
  tr {
    display: flex;
    flex-direction: column;
    width: 120px;
  }
</style>
